package com.frame.service.base.biz.convert.bak.dict;

import com.frame.common.component.dict.IDict;
import com.frame.convert.core.AbstractConverter;
import com.frame.convert.core.ConvertContext;
import com.frame.convert.core.ConvertListContext;

import java.util.function.Function;

/*
 * @author zhangyan
 * @date 2021-03-31 20:20:55
 **/
public class DictNameConverter extends AbstractConverter<DictName,IDict,String> {
    @Override
    public String convert(ConvertContext<DictName,IDict> context) {
        IDict source = context.getSourceValue();
        return source.getName();
    }

    @Override
    public Function<ConvertContext<DictName,IDict>, String> convertList(ConvertListContext<DictName,IDict> convertListContext) {
        return this::convert;
    }
}
